using UnityEngine;
namespace MeEditor
{
    public class CommonHelper
    {
          //获取文件名
        public static string GetFileNameByPath(string path)
        {
            path = path.Replace("\\", "/");
            int last_gang_index = path.LastIndexOf("/");
            if (last_gang_index == -1)
                return "";
            last_gang_index++;
            string name = path.Substring(last_gang_index, path.Length - last_gang_index);
            int last_dot_index = name.LastIndexOf('.');
            if (last_dot_index == -1)
                return "";
            name = name.Substring(0, last_dot_index);
            return name;
        }
        public static Texture2D MakeTex(int width, int height, Color col)
        {
            Color[] pix = new Color[width * height];

            for (int i = 0; i < pix.Length; i++)
            {
                pix[i] = col;
            }

            Texture2D result = new Texture2D(width, height);
            result.SetPixels(pix);
            result.Apply();

            return result;
        }
    }
}